package com.example.yichuangyun.http;

import com.example.yichuangyun.model.QrModel;
import com.example.yichuangyun.model.StatusModel;
import com.example.yichuangyun.model.UserInfoModel;
import com.example.yichuangyun.model.VersionModel;
import com.example.yichuangyun.model.business.BusinessDataModel;
import com.example.yichuangyun.model.business.BusinessDetailsModel;
import com.example.yichuangyun.model.business.CallRecordDataModel;
import com.example.yichuangyun.model.business.CompanyDataModel;
import com.example.yichuangyun.model.business.FollowDataModel;
import com.example.yichuangyun.model.business.LabelModel;
import com.example.yichuangyun.model.business.NewAddBusinessModel;
import com.example.yichuangyun.model.business.OrderModel;
import com.example.yichuangyun.model.index.ClueContendModel;
import com.example.yichuangyun.model.index.DaiBanDataModel;
import com.example.yichuangyun.model.index.MonthDataModel;
import com.example.yichuangyun.model.index.StatisticsDataModel;
import com.example.yichuangyun.model.index.TodayListModel;
import com.example.yichuangyun.model.index.ZhaoSModel;
import com.example.yichuangyun.utils.producttreelist.ProductNodeModel;
import com.example.yichuangyun.utils.treelist.SetShareBean;

import java.util.List;

import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Part;
import retrofit2.http.Path;
import retrofit2.http.Query;

public interface ApiService {
    /**
     * 获取验证码
     */
    @PUT(ApiFactory.getVCode)
    Observable<StatusModel> sendCode(@Body RequestBody requestBody);

    /**
     * 验证码登录
     */
    @POST(ApiFactory.codeLogin)
    Observable<HttpRespond<UserInfoModel>> loginByCode(@Body RequestBody requestBody);

    /**
     * 首页-今日统计
     */
    @POST(ApiFactory.getStatistics)
    Observable<HttpRespond<TodayListModel>> getTodayData(@Body RequestBody requestBody);

//    @GET(ApiFactory.getStatistics2)
//    Observable<HttpRespond<TodayListModel>> getTodayData();

    /**
     * 首页-本月业绩
     */
    @GET(ApiFactory.getMonthPerformanceReport)
    Observable<HttpRespond<MonthDataModel>> getMonthData(@Query("jobNumber") String jobNumber);

    /**
     * 本月佣金统计
     */
    @POST(ApiFactory.getMonthCommissionReport)
    Observable<HttpRespond<MonthDataModel>> getMonthCommission(@Body RequestBody requestBody);

    /**
     * 获取用户信息
     */
    @GET(ApiFactory.getUserInfo)
    Observable<HttpRespond<UserInfoModel>> getUserInfo();

    /**
     * 获取私库剩余额度
     */
    @GET(ApiFactory.getPriCount)
    Observable<HttpRespond<String>> getPriCount();

    /**
     * 获取本月招商业绩
     */
    @GET(ApiFactory.getAttractReportDetail)
    Observable<HttpRespond<List<ZhaoSModel>>> getAttractReportDetail(@Query("startTime") String startTime);

    /**
     * 首页-待办事项
     */
    @POST(ApiFactory.getBacklogSchedule)
    Observable<HttpRespond<DaiBanDataModel>> getBacklogSchedule(@Body RequestBody requestBody);

    /**
     * 获取剩余拨打电话次数
     */
    @GET(ApiFactory.numberLimit)
    Observable<HttpRespond<String>> getCallCount(@Query("telNumber") String telNumber);

    /**
     * 检验号码
     */
    @GET(ApiFactory.checkPhone + "{callTel}")
    Observable<HttpRespond<Boolean>> checkPhone(@Path("callTel") String callTel);

    /**
     * 首页-日历
     */
    @POST(ApiFactory.getMonthBlocklog)
    Observable<HttpRespond<List<String>>> getMonthBlockLog(@Body RequestBody requestBody);

    /**
     * 上传通话记录
     */
    @POST(ApiFactory.uploadCallRecord)
    Observable<HttpRespond<String>> uploadCallRecord(@Body RequestBody requestBody);

    /**
     * 上传通话录音文件
     */
    @Multipart
    @POST(ApiFactory.uploadRecord)
    Observable<HttpRespond<String>> uploadRecordFile(@Part MultipartBody.Part body);

    /**
     * 上传通话录音文件
     */
    @Multipart
    @POST(ApiFactory.upload + "/{id}")
    Observable<HttpRespond<String>> uploadRecordFile(@Part MultipartBody.Part body, @Path("id") String id);

    /**
     * 统计日报
     */
    @POST(ApiFactory.getStatistics)
    Observable<HttpRespond<StatisticsDataModel>> getStatistics(@Body RequestBody requestBody);

    /**
     * 签单统计
     */
    @POST(ApiFactory.getSignContactReportDetail)
    Observable<HttpRespond<StatisticsDataModel>> getSignContactReportDetail(@Body RequestBody requestBody);

    /**
     * 佣金统计
     */
    @POST(ApiFactory.getCommissionStatistics)
    Observable<HttpRespond<StatisticsDataModel>> getCommissionStatistics(@Body RequestBody requestBody);

    /**
     * 业绩统计
     */
    @POST(ApiFactory.getMonthPerformanceReportDetail)
    Observable<HttpRespond<StatisticsDataModel>> getMonthPerformanceReportDetail(@Body RequestBody requestBody);

    /**
     * 招商统计
     */
    @POST(ApiFactory.getAttractReportDetail)
    Observable<HttpRespond<StatisticsDataModel>> getAttractReportDetail(@Body RequestBody requestBody);

    /**
     * 获取标签项
     *
     * @param type group_type(意向业务)、state_type(意向状态)、source_type(商机来源)、tag_type(接听意向)、label_type(号码状态)、intention_intensity(意向强度)
     */
    @GET(ApiFactory.findByType)
    Observable<HttpRespond<List<LabelModel>>> getLabel(@Query("type") String type);

    /**
     * 修改商机
     */
    @POST(ApiFactory.editBusinessDetail)
    Observable<HttpRespond<String>> editBusinessDetail(@Body RequestBody requestBody);

    /**
     * 订单列表
     */
    @GET(ApiFactory.getOrderList + "{id}")
    Observable<HttpRespond<List<OrderModel>>> getOrderList(@Path("id") String id);

    /**
     * 商机竞选列表
     */
    @POST(ApiFactory.getOtherClue)
    Observable<HttpRespond<List<ClueContendModel>>> getOtherClue(@Body RequestBody requestBody);

    /**
     * 商机竞选（名大大）
     */
    @POST(ApiFactory.campaignMdd + "{id}/grab ")
    Observable<HttpRespond<String>> campaignMdd(@Path("id") String id);

    /**
     * 商机竞选
     */
    @POST(ApiFactory.BASE_SERVER + "/api/call/resource/pool/other/{resourceId}/grab")
    Observable<HttpRespond<String>> campaign(@Path("resourceId") String resourceId, @Query("bizType") int bizType);

    /**
     * 单图上传
     */
    @Multipart
    @POST(ApiFactory.upload)
    Observable<HttpRespond<String>> uploadImage(@Part MultipartBody.Part image_part);

    /**
     * 丢单
     */
    @POST(ApiFactory.lostOrder)
    Observable<HttpRespond<String>> lostOrder(@Body RequestBody requestBody);

    /**
     * 废弃
     */
    @POST(ApiFactory.discardBusiness)
    Observable<HttpRespond<String>> discardBusiness(@Body RequestBody requestBody);

    @POST(ApiFactory.selectOrderInfo)
    Observable<HttpRespond<String>> selectOrderInfo(@Body RequestBody requestBody);

    /**
     * 共享人列表tree
     */
    @POST(ApiFactory.getOrgTree)
    Observable<SetShareBean> getTreeData(@Body RequestBody requestBody);

    /**
     * 设置共享人
     */
    @POST(ApiFactory.saveShare)
    Observable<HttpRespond<String>> saveSharePerson(@Body RequestBody requestBody);

    /**
     * 版本更新
     */
    @GET(ApiFactory.getVersionInfo)
    Observable<HttpRespond<VersionModel>> getVersionInfo();

    /**
     * 个推绑定客户端cid
     */
    @POST(ApiFactory.bindCid + "{cid}/bindCid")
    Observable<HttpRespond<String>> bindCid(@Path("cid") String cid);

    /**
     * 扫码登录
     */
    @POST(ApiFactory.scan_login)
    Observable<QrModel> scanLogin(@Body RequestBody requestBody);

    /**
     * 登录状态
     */
    @GET(ApiFactory.desensitization)
    Observable<String> getLoginStatus();

    /**
     * 获取管帮手录音文件
     */
    @POST(ApiFactory.getRecordUrl)
    Observable<HttpRespond<String>> getRecordUrl(@Body RequestBody requestBody);

    /**
     * 获取电话系统录音文件
     */
    @POST(ApiFactory.getPcRecordUrl + "{fileName}")
    Observable<HttpRespond<String>> getPcRecordUrl(@Path("fileName") String fileName);


    /**
     * 获取意向产品列表树
     */
    @GET(ApiFactory.getProductTree)
    Observable<HttpRespond<List<ProductNodeModel>>> getProductTree(@Query("keywords") String keywords, @Query("category") int category);
//    Observable<HttpRespond<List<ProductNodeModel>>> getProductTree(@Query("keywords") String keywords);

    /**
     * 新增商机
     */
    @POST(ApiFactory.saveBusiness)
    Observable<HttpRespond<String>> saveBusiness(@Body RequestBody requestBody);

    /**
     * 商机列表
     */
    @POST(ApiFactory.getBusinessList)
    Observable<HttpRespond<BusinessDataModel>> getBusinessList(@Body RequestBody requestBody);

    /**
     * 商机类型
     */
    @POST(ApiFactory.getBusinessType)
    Observable<HttpRespond<List<LabelModel>>> getBusinessType();

    /**
     * 商机详情
     */
    @GET(ApiFactory.getClientDetails)
    Observable<HttpRespond<BusinessDetailsModel>> getBusinessDetails(@Query("chanceId") String chanceId);

    /**
     * 根据公司名称模糊查询信息（闲置）
     */
    @GET(ApiFactory.getInfoByCompanyName)
    Observable<HttpRespond<List<CompanyDataModel.CompanyInfoModel>>> getInfoByCompanyName(@Query("companyName") String companyName);

    /**
     * 根据公司名称模糊查询信息（启信宝）
     */
    @POST(ApiFactory.getCompanyByQxb)
    Observable<HttpRespond<CompanyDataModel>> getCompanyByQxb(@Body RequestBody requestBody);

    /**
     * 通话记录
     */
    @POST(ApiFactory.getBusinessCallLog)
    Observable<HttpRespond<CallRecordDataModel>> getBusinessCallLog(@Body RequestBody requestBody);

    /**
     * 商机跟进记录
     */
    @POST(ApiFactory.getFollowLog)
    Observable<HttpRespond<FollowDataModel>> getFollowLog(@Body RequestBody requestBody);

    /**
     * 联系人跟进记录
     */
    @POST(ApiFactory.getContactsFollowLog)
    Observable<HttpRespond<FollowDataModel>> getContactsFollowLog(@Body RequestBody requestBody);

    /**
     * tab页跟进记录
     */
    @POST(ApiFactory.getTabFollowLog)
    Observable<HttpRespond<FollowDataModel>> getTabFollowLog(@Body RequestBody requestBody);

    /**
     * 添加跟进
     */
    @POST(ApiFactory.addFollowUp)
    Observable<HttpRespond<String>> addFollowUp(@Body RequestBody requestBody);

    /**
     * 联系人添加跟进
     */
    @POST(ApiFactory.addContactsFollowUp)
    Observable<HttpRespond<String>> addContactsFollowUp(@Body RequestBody requestBody);

    /**
     * 商机来源
     */
    @GET(ApiFactory.getBusinessSource)
    Observable<HttpRespond<List<ProductNodeModel>>> getBusinessSource(@Query("keywords") String keywords);

    /**
     * 商机来源
     */
    @GET(ApiFactory.getContactsSource)
    Observable<HttpRespond<List<ProductNodeModel>>> getContactsSource();

    /**
     * 检测是否有按钮权限
     */
    @POST(ApiFactory.checkButtonOrTab)
    Observable<HttpRespond<Boolean>> checkButtonOrTab(@Body RequestBody requestBody);

    /**
     * 商机详情-资料详情
     */
    @GET(ApiFactory.getInformationDetail)
    Observable<HttpRespond<NewAddBusinessModel>> getInformationDetail(@Query("chanceId") String chanceId);

    /**
     * 获取商机来源
     */
    @POST(ApiFactory.getSources)
    Observable<HttpRespond<List<LabelModel>>> getSources();

    /**
     * 回拨外呼
     */
    @POST(ApiFactory.callbackOutbound)
    Observable<HttpRespond<String>> callbackOutbound(@Body RequestBody requestBody);

    /**
     * 联系人类型
     */
    @POST(ApiFactory.getContactsType)
    Observable<HttpRespond<List<LabelModel>>> getContactsType();

    /**
     * 获取eid
     */
    @POST(ApiFactory.getEid)
    Observable<HttpRespond<com.example.yichuangyun.model.company.CompanyDataModel.CompanyModel>> getEid(@Body RequestBody requestBody);

    /**
     * 废弃审核
     */
    @POST(ApiFactory.PC_SERVER + "/crmapi/business/checkDiscardBusiness")
    Observable<HttpRespond<String>> checkDiscardBusiness(@Body RequestBody requestBody);
}
